/*     */ package eos.moe.dragoncore.api;
/*     */ 
/*     */ import eos.moe.dragoncore.api.model.AnimationEntityModel;
/*     */ import eos.moe.dragoncore.api.model.IModel;
/*     */ import eos.moe.dragoncore.bg;
/*     */ import eos.moe.dragoncore.bo;
/*     */ import eos.moe.dragoncore.ee;
/*     */ import eos.moe.dragoncore.gk;
/*     */ import eos.moe.dragoncore.ld;
/*     */ import eos.moe.dragoncore.pm;
/*     */ import eos.moe.dragoncore.th;
/*     */ import eos.moe.dragoncore.zq;
/*     */ import eos.moe.dragoncore.zz;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import java.util.UUID;
/*     */ import java.util.concurrent.ExecutorService;
/*     */ import java.util.concurrent.Executors;
/*     */ import net.minecraft.client.Minecraft;
/*     */ import net.minecraft.client.model.ModelBase;
/*     */ import net.minecraft.client.renderer.texture.ITextureObject;
/*     */ import net.minecraft.client.renderer.texture.TextureManager;
/*     */ import net.minecraft.util.ResourceLocation;
/*     */ import net.minecraft.util.text.ITextComponent;
/*     */ import net.minecraft.util.text.TextComponentString;
/*     */ 
/*     */ public class PlayerModelLoader {
/*  28 */   public static final Map<String, zz> animations = new HashMap<>();
/*  29 */   public static final HashMap<String, ModelBase> models = new HashMap<>();
/*  30 */   private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool();
/*     */   
/*     */   public static void clear() {
/*  33 */     animations.clear();
/*  34 */     models.clear();
/*     */   }
/*     */   public static void shutdown() {
/*  37 */     EXECUTOR.shutdownNow();
/*     */   }
/*     */   
/*     */   public static IModel getModel(String a, byte[] arrayOfByte) {
/*  41 */     if (!models.containsKey(a)) {
/*  42 */       EXECUTOR.submit(() -> {
/*     */             try {
/*     */               ld ld = th.v(a, arrayOfByte);
/*     */ 
/*     */               
/*     */               models.put(a, ld);
/*  48 */             } catch (Exception exception) {
/*     */               exception.printStackTrace();
/*     */               (Minecraft.func_71410_x()).field_71439_g.func_145747_a((ITextComponent)new TextComponentString("§c无法加载玩家时装模型:" + a));
/*     */             } 
/*     */           });
/*  53 */       models.put(a, th.v());
/*     */     } 
/*     */     
/*  56 */     return (IModel)models.get(a);
/*     */   }
/*     */   
/*     */   public static void clearData(String a) {
/*  60 */     if (models.containsKey(a)) {
/*  61 */       ((ld)models.get(a)).clearData();
/*     */     }
/*     */   }
/*     */   
/*     */   public static void bindTexture(String a, byte[] arrayOfByte) {
/*  66 */     TextureManager textureManager = Minecraft.func_71410_x().func_110434_K();
/*  67 */     ResourceLocation resourceLocation = new ResourceLocation("dragoncore", "models/player/" + a + "/texture.png");
/*  68 */     ITextureObject iTextureObject = textureManager.func_110581_b(resourceLocation);
/*  69 */     if (iTextureObject == null) {
/*  70 */       zq zq = new zq(arrayOfByte);
/*  71 */       textureManager.func_110579_a(resourceLocation, (ITextureObject)zq);
/*     */     } 
/*  73 */     textureManager.func_110577_a(resourceLocation);
/*     */   }
/*     */   
/*     */   public static void bindGlowTexture(String a, byte[] arrayOfByte) {
/*  77 */     TextureManager textureManager = Minecraft.func_71410_x().func_110434_K();
/*  78 */     ResourceLocation resourceLocation = new ResourceLocation("dragoncore", "models/player/" + a + "/glow_texture.png");
/*  79 */     ITextureObject iTextureObject = textureManager.func_110581_b(resourceLocation);
/*  80 */     if (iTextureObject == null) {
/*  81 */       zq zq = new zq(arrayOfByte);
/*  82 */       textureManager.func_110579_a(resourceLocation, (ITextureObject)zq);
/*     */     } 
/*  84 */     textureManager.func_110577_a(resourceLocation);
/*     */   }
/*     */   
/*     */   public static boolean hasGlowTexture(byte[] a) {
/*  88 */     return (a != null && a.length > 0);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public static void applyAnimation(UUID a, String str1, byte[] arrayOfByte, String str2, boolean bool) {
/* 104 */     ModelBase modelBase = models.get(str1);
/*     */     
/* 106 */     if (modelBase instanceof ld && arrayOfByte != null && arrayOfByte.length > 0) {
/* 107 */       if (!animations.containsKey(a.toString() + "_" + str1)) {
/* 108 */         pm pm = pm.z();
/*     */         try {
/* 110 */           Map map = bg.v("models/player/" + str1 + "/animation.json", arrayOfByte);
/*     */ 
/*     */ 
/*     */           
/* 114 */           pm.v(map);
/* 115 */           map.forEach((str, bo1) -> {
/*     */                 if (str.contains("idle")) {
/*     */                   a.v(str, ee.q, 1.0F);
/*     */                   a.v((new gk(bo1)).v(1.0F), str);
/*     */                 } else {
/*     */                   a.v(str, ee.w, 1.0F);
/*     */                 } 
/*     */               });
/* 123 */         } catch (Exception exception) {}
/*     */ 
/*     */         
/* 126 */         animations.put(a + "_" + str1, pm.v());
/*     */       } 
/* 128 */       zz zz = animations.get(a + "_" + str1);
/*     */       
/* 130 */       if ("idle".equals(str2)) {
/* 131 */         if (zz.v() != null && 
/* 132 */           !zz.isOnPlayAnimation()) {
/* 133 */           gk gk = zz.v().v();
/* 134 */           zz.v(gk, zz.v().v());
/*     */         } 
/*     */       } else {
/*     */         
/* 138 */         bo bo = (bo)zz.h().get(str2);
/* 139 */         if (bo != null) {
/* 140 */           zz.v(null, 0);
/* 141 */           zz.v(new gk(bo), str2);
/*     */         } 
/*     */       } 
/* 144 */       if (bool)
/*     */       {
/* 146 */         zz.v((AnimationEntityModel)modelBase);
/*     */       }
/*     */     } 
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\api\PlayerModelLoader.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */